package com.chen.apipassenger.controller;

import com.chen.apipassenger.request.RefreshToken;
import com.chen.apipassenger.service.TokenService;
import com.chen.internalcommon.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chenLiuPing
 **/
@RestController
public class TokenController {

    @Autowired
    private TokenService tokenService;

    /**
     * token刷新接口
     */
    @PostMapping("/token-refresh")
    public ResponseResult refreshToken(@RequestBody RefreshToken refreshToken) {
        String refreshTokenSrc = refreshToken.getRefreshToken();
        return tokenService.refreshToken(refreshTokenSrc);
    }
}
